package com.example.zhihuigongdi.controller;


import com.example.zhihuigongdi.entity.DTO.LoginFormDTO;
import com.example.zhihuigongdi.entity.Machinery;
import com.example.zhihuigongdi.entity.Personnel;
import com.example.zhihuigongdi.entity.respon.Result;
import com.example.zhihuigongdi.service.IPersonnelService;
import com.example.zhihuigongdi.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liuhongbin
 * @since 2024-04-17
 */
@RestController
@RequestMapping("/personnel")
public class PersonnelController {
    @Autowired
    @Lazy
    private IPersonnelService personnelService;

    @PostMapping("/list/{current}/{size}")
    public Result list(@PathVariable int current,@PathVariable int size){
        return personnelService.getPersonnels(current,size);
    }

    @PostMapping("/add")
    public Result add(@RequestBody Personnel personnel){
        return personnelService.addPersonel(personnel);
    }

    @PostMapping("/add/{employeeId}")
    public Result remove(@PathVariable int employeeId ){
        return personnelService.removePersonnel(employeeId);
    }


}
